All Questions
68 questions
4votes
2answers
959views
LeetCode 3366: Minimum Array Sum - w/o DP/memoisation
This program tried to solve LeetCode problem 3366: Minimum Array Sum. It fails for k odd, op1+op2 high enough such there are more odd value to optionally subtract k from than subtractions to allot. A ...
4votes
1answer
320views
c++ quicksort pivots
Is this code for quicksort using the first index as a pivot correct? Also if I want to use the last or middle index as a pivot how would the whole code change? ...
2votes
1answer
3kviews
Assignment function for Intervals container
I found the two related questions but they, however, do not answer my question: interval map implementation Where exactly does my code not adhere to the specification of the key and value type? The ...
5votes
1answer
236views
Traverse/transform (xml) tree
I am trying to write a utility for transforming xml trees using single pass and specifying node handlers. I used pugixml prior to this, and the library provides a ...
5votes
1answer
352views
Bin-packing C++ solution using multi-map
The need (context). Several times a day, we need to migrate a set of digital assets from one system to another. The process uses memory (the assets are held in memory for a short time) and we need to ...
4votes
1answer
711views
A-star pathfinding algorithm
I'm working on a school project where I need to implement the pathfinding algorithm. The requirements are that it needs to find the path in at most a few seconds and ideally in less than 1 second. I'...
2votes
1answer
172views
LeetCode 665: Non-decreasing Array
I'm posting a solution for LeetCode's "Non-decreasing Array". If you'd like to review, please do. Thank you! Problem Given an array nums with ...
4votes
3answers
615views
LeetCode 535: Encode and Decode TinyURL
I'm posting a solution for LeetCode's "Encode and Decode TinyURL". If you'd like to review, please do. Thank you! Problem TinyURL is a URL shortening service where you enter a URL such as <...
4votes
3answers
743views
LeetCode 641: Design Circular Deque
I'm posting a solution for LeetCode's "Design Circular Deque". If you'd like to review, please do so. Thank you! Problem Design your implementation of the circular double-ended queue (deque)....
5votes
1answer
412views
Aho-Corasick C++17 implementation
Recently I implemented the algorithm, that can find all the patterns which may contain "?" as "any character". For example, if the text is "abracadabra" and the pattern ...
3votes
1answer
152views
Bubble Sort In C++
I'm learning modern C++ and also algorithms, and am doing some practice by coding up some simple algorithms. Also trying to use templates whenever possible as I'm quite unfamiliar with generic ...
4votes
1answer
197views
LeetCode 310: Minimum Height Trees
Posting my code for a LeetCode problem, if you'd like to review, please do so. Thank you for your time! Problem For an undirected graph with tree characteristics, we can choose any node as the root. ...
1vote
1answer
329views
LeetCode 1206: Design Skiplist
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Design a Skiplist without using any built-in libraries. A Skiplist is a data ...
3votes
0answers
412views
LeetCode 1263: Minimum Moves to Move a Box to Their Target Location ||
I'm posting a follow-up code on this question, which seems to be a version of Sokoban. If you'd like to review, please do so. Thank you for your time! Problem Storekeeper is a game in which the ...
2votes
1answer
302views
LeetCode 1263: Minimum Moves to Move a Box to Their Target Location
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Storekeeper is a game in which the player pushes boxes around in a warehouse trying ...